package br.edu.fa7.quotes.ui;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import br.edu.fa7.quotes.R;
import br.edu.fa7.quotes.model.Quote;
import br.edu.fa7.quotes.model.QuoteDB;

public class MainActivity extends Activity {

	private static QuoteDB quoteDB;
	private Quote quote;
	private TextView tv;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		if (getIntent().getBooleanExtra("sairApp", false)) {
			finish();
			return;
		}
		
		quoteDB = new QuoteDB(this);
		quote = quoteDB.todaysQuote();

		setContentView(R.layout.activity_main);
		tv = (TextView) findViewById(R.id.txtAuthor);
		tv.setText(quote.getAuthor());
	}
	
}
